<?php
 include_once("../array/tool_array.php");
 include_once("./class_tree.php");
 include_once("./tool_tree.php");
 include_once("./class_drawer_svg.php");
 require "../files/tool_files_dirs.php";
 require "../misc/tool_color.php";

 $a=new tree("a",array(),0);
 $b=new tree("b",array(),1,$a);
 $c=new tree("c",array(),2,$a);
 $d=new tree("d",array(),3,$a);
 $e=new tree("e",array(),4,$b);
 $f=new tree("f",array(),5,$e);
 $g=new tree("g",array(),6,$c);
 $z=new tree("z",array(),26,$a);


 $e->__add_tree($f);
 $b->__add_tree($e);
 $c->__add_tree($g);
 $a->__add_tree($b);
 $a->__add_tree($c);
 $a->__add_tree($d);

function print_tree($_tree){
  $drawer=new drawer_svg();
  return "  <svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"
    xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"
    width=\"".$drawer->dsvg_tree_get_html_width($_tree)."\" 
    height=\"".$drawer->dsvg_tree_get_html_height($_tree)."\">
    ".$drawer->dsvg_tree_draw($_tree)."
  </svg>";
 }


$header_xml="<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:svg=\"http://www.w3.org/2000/svg\">
";

//print_r($a);
//die();

$out=print_tree($a);
$out_clean=print_tree($a->__clone_clean());
Tool_files::file_write("test.xhtml","$header_xml $out $out_clean</html>");
die();

 //$clone_a=clone $a; 
 //$a->__add_tree($z);
 //$a="d";
 //echo $clone_a;
 //die();
 //$res=Tool_tree::tree2txt($a);
 //echo $res;

 $forest=new forest(array($a));
// $clone_forest=$forest->__get_clone_array_root();
 //echo $clone_forest;
// foreach($clone_forest as $tree){echo $tree;}
// $res_forest=tool_tree::forest2txt($clone_forest);
// echo $res_forest;
// die();
 //$delr=$forest->__del_right();
 //$delrr=$delr->__del_right();
 $res_forest=Tool_forest::forest2txt($forest);
 //$res_delr=Tool_forest::forest2txt($delr);
 //$res_delrr=Tool_forest::forest2txt($delrr);
// echo $res_forest;
 //echo $res_delr;
// echo $res_delr;
// echo $res_delrr;

// $ted=new TED_shasha();
// $ted->__init($forest,$forest);
// echo tool_ted::ted2txt($ted,$forest,$forest);
?>
